import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path"; // 类型报错，pnpm add @types/node -D
import qiankun from "vite-plugin-qiankun";
import pkg from "./package.json";

const resolve = (relative: string) => {
  // path.resolve返回值是绝对路径
  // __dirname 当前文件所处的文件夹路径
  return path.resolve(__dirname, relative);
};

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(), qiankun(pkg.name, { useDevMode: true })],
  resolve: {
    alias: {
      "@": resolve("src"),
    },
  },
});
